package cn.thoughtworks.school.commands;

import cn.thoughtworks.school.entities.User;
import lombok.Getter;
import lombok.Setter;

import java.util.Date;
import java.util.Map;

@Setter
@Getter
public class CreateUserCommand {
    private Long userId;
    private String username;
    private String email;
    private String password;
    private String org;

    private String gender;
    private String mobilePhone;
    private String school;
    private String degree;
    private String major;
    private Date entranceYear;
    private Date graduationTime;
    private String schoolProvince;
    private String schoolCity;
    private String joinCity;
    private String whenHear;
    private String recuritMessage;

    private String browser;
    private String os;
    private String platform;
    private String inch;
    private String activityName;
    private String source;
    private String code;

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getOrg() {
        return org;
    }

    public void setOrg(String org) {
        this.org = org;
    }

    public String getBrowser() {
        return browser;
    }

    public void setBrowser(String browser) {
        this.browser = browser;
    }

    public String getOs() {
        return os;
    }

    public void setOs(String os) {
        this.os = os;
    }

    public String getPlatform() {
        return platform;
    }

    public void setPlatform(String platform) {
        this.platform = platform;
    }

    public String getInch() {
        return inch;
    }

    public void setInch(String inch) {
        this.inch = inch;
    }

    public String getActivityName() {
        return activityName;
    }

    public void setActivityName(String activityName) {
        this.activityName = activityName;
    }

    public String getSource() {
        return source;
    }

    public void setSource(String source) {
        this.source = source;
    }

    public Long getUserId() {
        return userId;
    }

    public void setUserId(Long userId) {
        this.userId = userId;
    }

    public String getGender() {
        return gender;
    }

    public void setGender(String gender) {
        this.gender = gender;
    }

    public String getMobilePhone() {
        return mobilePhone;
    }

    public void setMobilePhone(String mobilePhone) {
        this.mobilePhone = mobilePhone;
    }

    public String getSchool() {
        return school;
    }

    public void setSchool(String school) {
        this.school = school;
    }

    public String getDegree() {
        return degree;
    }

    public void setDegree(String degree) {
        this.degree = degree;
    }

    public String getMajor() {
        return major;
    }

    public void setMajor(String major) {
        this.major = major;
    }

    public Date getEntranceYear() {
        return entranceYear;
    }

    public void setEntranceYear(Date entranceYear) {
        this.entranceYear = entranceYear;
    }

    public String getJoinCity() {
        return joinCity;
    }

    public void setJoinCity(String joinCity) {
        this.joinCity = joinCity;
    }

    public String getWhenHear() {
        return whenHear;
    }

    public void setWhenHear(String whenHear) {
        this.whenHear = whenHear;
    }

    public String getRecuritMessage() {
        return recuritMessage;
    }

    public void setRecuritMessage(String recuritMessage) {
        this.recuritMessage = recuritMessage;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public User buildRegisterUser(Long userId) {
        return new User(userId, source, new Date(), activityName, browser, os, platform, inch);
    }

    public Map updateUserDetail(Map userDetail) {
        userDetail.put("gender", gender);
        userDetail.put("mobilePhone", mobilePhone);
        userDetail.put("school", school);
        userDetail.put("major", major);
        userDetail.put("entranceYear", entranceYear);
        userDetail.put("degree", degree);
        userDetail.put("schoolProvince", schoolProvince);
        userDetail.put("schoolCity", schoolCity);

        return userDetail;
    }

    public User completeUser(User user) {
        user.setJoinActivityTime(new Date());
        user.setJoinCity(joinCity);
        user.setSource(source);
        user.setRecruitMessage(recuritMessage);
        user.setActivityName(activityName);
        user.setBrowser(browser);
        user.setOs(os);
        user.setPlatform(platform);
        user.setInch(inch);
        user.setWhenHear(whenHear);
        user.setGraduationTime(graduationTime);
        return user;
    }
}
